<?php
$name = getInputArray("name", $params,'');
$validate = getInputArray("validate", $params,'');
$id = getInputArray("id", $params,str_replace(".","",str_replace(" ","",microtime())));
$required = getInputArray("required", $params,false);

$requiredString = "false";
if($required){
	$requiredString = "true";
}

$text = getInputArray("text", $params,'');
$value = getInputArray("value", $params,$text);
$labelid = str_replace(".","",str_replace(" ","",microtime()));
$messageRequired = getInputArray("messageRequired", $params,langEcho("messageRequired"));
$messageValidate = getInputArray("messageValidate", $params,langEcho("messagevalidateurl"));


$class = getInputArray("class", $params,'');


echo "<input type='text' "; 
if ($name != "") echo " name='" . $name ."' ";
 
if ($id != "") echo " id='" . $id ."' ";

if ($class != "") echo " class='" . $class ."' ";

$onfocus = "";
$onblur = "";
if($text != ''){
	$onfocus .= "cleanValue('$id','$text');";
	$onblur .= "setValue('$id','$text');";
}

if($onfocus != ''){
	echo " onfocus=\"$onfocus\" ";
}

$onblur .= " validate_url(this.value, " . $requiredString . ", '" . $labelid . "','".$messageRequired."','".$messageValidate."', '$text');"; 
if($onblur != ''){
	echo "onblur=\"$onblur\"";
}

if ($value != "") echo " value='" . $value ."' ";

echo "/><span class='validateTextbox' id='".$labelid."' ></span>";
if($validate != ''){
echo '<script type="text/javascript">';
echo "registerValidation('$validate', '$id',$requiredString, 'url', '$labelid', '$messageRequired', '$messageValidate','$text')";
echo '</script>';
}
?>